#!/usr/bin/perl
#Programmer: Rory Carmichael
#Purpose: generate a given number of random reverse translations (rrts) for a given query sequence and codon usage table and run min-max on all of them
#Usage: rrt-wrapper.pl <query_sequence> <codon_usage_table> <num rrts>

my $qry_seq = $ARGV[0];
my $codon_table = $ARGV[1];
my $num_rrts = $ARGV[2];
my $prefix = [split(/\//, $qry_seq)]->[-1];

for(my $i=0;$i<$num_rrts;$i++) {
	`./rrt-gen.pl $qry_seq $codon_table > $prefix.rrt_$i.fa`;
}
for(my $i=0;$i<$num_rrts;$i++) {
	`./better-min-max.pl $prefix.rrt_$i.fa $codon_table | ./discretize-mm.pl >> $prefix.rrt_all.disc-mm`;
	`rm $prefix.rrt_$i.fa`;
}
